﻿using Microsoft.Extensions.Configuration;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;

namespace FileConvert
{
    public class AppConfig
    {
        private static IConfigurationRoot _configuration=null;
        private static void InitConfig()
        {
            var builder = new ConfigurationBuilder()
           .SetBasePath(Directory.GetCurrentDirectory())
           .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true);
            _configuration = builder.Build();
        }

        public static IConfigurationRoot configuration
        {
            get
            {
                if (_configuration == null)
                {
                    InitConfig();
                }
                return _configuration;
            }
        }
    }
}
